home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- global proc polyLaunchPaintReduceTool()
- //
- // Description:
- // A convenience procedure for launching the paint reduce weights tool.
- //
- {
-
- // Sometimes when the paint tool is launched from the Edit Polygons menu
- // the artAttrCreateMenuItems.mel file has not been sourced. Do it now
- // to make sure we execut artSetToolAndSelectAttr.
- //
- if (`whatIs artSetToolAndSelectAttr` == "Unknown" )
- {
- source artAttrCreateMenuItems.mel;
- }
-
- // Check selection list validity
- //
- string $sel[] = `ls -sl`;
- if ( size( $sel ) == 0 ) {
- warning("Please select a polyReduce node (or a mesh upstream or downstream of one).");
- return;
- }
-
- if ( size( $sel ) > 1 ) {
- warning("Multiple objects selected: Attempting to paint only the first item in selection list.");
- }
-
- // Try to find a reduce node. Look downstream first.
- //
- string $nodes[] = `listHistory -future true $sel[0]`;
- string $node = "";
- string $target = "";
- for ($node in $nodes) {
- if ( "polyReduce" == `nodeType $node` ) {
- $target = $node;
- break;
- }
- }
-
- // If no reduce node is found downstream, try upstream.
- //
- if ( "" == $target ) {
- $nodes = `listHistory -future false $sel[0]`;
- for ($node in $nodes) {
- if ( "polyReduce" == `nodeType $node` ) {
- $target = $node;
- break;
- }
- }
- }
-
-
- // If we still haven't found a reduce node, then the selection isn't
- // paintable.
- //
- if ( "" == $target ) {
- warning("Please select a polyReduce node (or a mesh upstream or downstream of one).");
- return;
- }
-
- artSetToolAndSelectAttr( "artAttrCtx", "polyReduce." + $target + ".weights" );
-
- }
-